package com.douma.dto;

import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;

/**
 * 抖码课堂，专注中国程序员基础内功修炼
 * 官网：douma-tech.com
 * 公众号：抖码课堂
 *
 * @作者 : 老汤
 */
public class Shop {
    private long id;
    private String name;
    private int score;
    private int comments;
    private long avgPrice;
    private String address;
    private String openHours;
    private String phone;

    private LocalDateTime expireTime;

    public static Shop buildFromMap(Map<Object, Object> map) {
        Shop shop = new Shop();
        shop.setId(Long.valueOf(map.get("id").toString()));
        shop.setName(map.get("name").toString());
        shop.setScore(Integer.valueOf(map.get("score").toString()));
        shop.setComments(Integer.valueOf(map.get("comments").toString()));
        shop.setAvgPrice(Long.valueOf(map.get("avgPrice").toString()));
        shop.setAddress(map.get("address").toString());
        shop.setOpenHours(map.get("openHours").toString());
        shop.setPhone(map.get("phone").toString());
        return shop;
    }

    public Map<String, String> genMap() {
        Map<String, String> map = new HashMap<>();
        map.put("id", String.valueOf(id));
        map.put("name", name);
        map.put("score", String.valueOf(score));
        map.put("comments", String.valueOf(comments));
        map.put("avgPrice", String.valueOf(avgPrice));
        map.put("address", address);
        map.put("openHours", openHours);
        map.put("phone", phone);
        return map;
    }

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getScore() {
        return score;
    }

    public void setScore(int score) {
        this.score = score;
    }

    public int getComments() {
        return comments;
    }

    public void setComments(int comments) {
        this.comments = comments;
    }

    public long getAvgPrice() {
        return avgPrice;
    }

    public void setAvgPrice(long avgPrice) {
        this.avgPrice = avgPrice;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public String getOpenHours() {
        return openHours;
    }

    public void setOpenHours(String openHours) {
        this.openHours = openHours;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public LocalDateTime getExpireTime() {
        return expireTime;
    }

    public void setExpireTime(LocalDateTime expireTime) {
        this.expireTime = expireTime;
    }

    @Override
    public String toString() {
        return "Shop{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", score=" + score +
                ", comments=" + comments +
                ", avgPrice=" + avgPrice +
                ", address='" + address + '\'' +
                ", openHours='" + openHours + '\'' +
                ", phone='" + phone + '\'' +
                '}';
    }
}
